package com.lry.web.fiction.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lry.web.fiction.entity.FictionUpdate;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface FictionUpdateMapper extends BaseMapper<FictionUpdate> {

    @Update("update fiction_update set deleted=0 where fiction_id = #{fictionId} and deleted=1")
    int updateDeleted(@Param("fictionId")String fictionId);

    @Delete("delete from fiction_update where fiction_id = #{fictionId}")
    int deleteByFictionId(@Param("fictionId")String fictionId);

    @Delete("delete from fiction_update where fiction_variable_id = #{fVId}")
    int deleteByFVId(@Param("fVId")String fVId);

    @Update("update fiction_update set deleted=1 where DATE_SUB(CURDATE(), INTERVAL 30 DAY) > date(update_time)")
    void updateTime30T();
}
